<template>
	<view class="signUpBox"
		style="background-image: url(https://tuzhuang-1304727035.file.myqcloud.com/tinymce/images/9de8264c276b88f7c78135bce7cd92dc62cd1222bf6a6.jpg);"
	>
		<!-- 最上面图片 -->
		<!-- <view 
			class="signUpBox_top"
			
		> -->
			<!-- 千万补贴 -->
			<!-- <view class="signUpBox_top_qianwan">
				<image src="http://tuzhuang-1304727035.file.myqcloud.com/images/0464d0b5a9eb881f2e4aa12313a8ae04.png"></image>
			</view> -->
			<!-- 0利润装修    节点支付 -->
			<!-- <view class="commonText" style="margin-top: 186rpx;">
				0利润装修    节点支付
			</view> -->
			<!-- 先施工后结算： -->
			<!-- <view class="commonText">
				先施工后结算
			</view> -->
			<!-- 全程3方监理服务 -->
			<!-- <view class="commonText">
				全程3方监理服务
			</view> -->
			<!-- <view class="signUpBox_top_qianwan xingyun" style="margin-top: 96rpx;">
				<image src="http://tuzhuang-1304727035.file.myqcloud.com/images/68a9e9370d8b440d1e1b89e5b45702f1.png"></image>
			</view> -->
		<!-- </view> -->
		
		<!-- 下面内容 -->
		<view class="signUpBox_bottom">
			<!-- 第一个框子 -->
			<view class="signUpBox_bottom_one" v-if="rlistatus == 0">
				<view class="common_input" >
					<!-- <text>您的姓名*：</text> -->
					<view>
						<input 
							type="text" 
							v-model="nameValue" 
							placeholder=" " 
						/>
					</view>
				</view>
				<view class="common_input">
					<!-- <text>您的电话*：</text> -->
					<view>
						<input 
							type="number" 
							v-model="phobeValue" 
							placeholder=" " 
							maxlength="11"
						/>
					</view>
				</view>
				<view class="common_input">
					<!-- <text>您的地址*：</text> -->
					<view>
						<input 
							type="text" 
							v-model="addressValue" 
							placeholder=" " 
						/>
					</view>
				</view>
				
				<view class="signUpBox_bottom_one_btn"  @tap="gotoChenggong">
					<!-- 提交报名 -->
				</view>
			</view>
			
			<view class="signUpBox_bottom_one" v-else-if="rlistatus == 1">
				<view class="common_input" >
					<view>
						<text class="wenzi">{{rlist.name}}</text>
					</view>
				</view>
				<view class="common_input">
					<view>
						<text class="wenzi">{{rlist.phone}}</text>
					</view>
				</view>
				<view class="common_input">
					<view>
						<text class="wenzi">{{rlist.address}}</text>
					</view>
				</view>
				
				<view class="signUpBox_bottom_one_btn"  @tap="gotoChenggong">
					<!-- 提交报名 -->
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	import {getOrderIndexActivity} from '@/utils/getRequest.js'
	export default {
		data() {
			return {
				nameValue:'',
				phobeValue:'',
				addressValue:'',
				rlistatus:0,
				rlist:[]
			}
		},
		methods: {
			gotoChenggong(){
				if(this.rlistatus == 1){
					uni.showToast({
						title: '已预约',
						icon:'success',
						duration: 2000
					});
					return;
				}
				if(!this.nameValue){
					uni.showToast({
						title: '请填写姓名',
						icon:'none',
						duration: 2000
					});
					return;
				}
				if(!this.phobeValue){
					uni.showToast({
						title: '请填写电话',
						icon:'none',
						duration: 2000
					});
					return;
				}
				if(!this.addressValue){
					uni.showToast({
						title: '请填写地址',
						icon:'none',
						duration: 2000
					});
					return;
				}
				let phoneTs = /^1[3|4|5|6|7|8][0-9]{9}$/;
				if (!phoneTs.test(this.phobeValue)) {
					uni.showToast({
					    title: '手机号格式不正确',
					    duration: 2000,
						icon:'none'
					});
					return;
				}
				getOrderIndexActivity({
					type:1,
					type_name:'0元购',
					name:this.nameValue,
					phone:this.phobeValue,
					address:this.addressValue
				}).then(res=>{
					console.log(res,'返回数据');
					if(res.code){console.log(res,'返回数啊据');
						uni.showToast({
						    title: '预约成功',
						    duration: 2000,
							icon:'success'
						});
						
						this.rlistatus = 1;
					}
				})
				
			},
			async getInfo(){
				uni.showLoading()
				
				var res = await getOrderIndexActivity({status:1});
				this.rlistatus = res.code;
				this.rlist = res.data;
				uni.hideLoading()
			}
		},
		onShow(){
			this.getInfo()
		},
		onLoad(params){
			this.getInfo()
		}
	}
</script>

<style scoped>
@import url("./rTextDsubordinate.css");
</style>
